<template>
    <div style="width: 95%;margin: 0 auto;">
        <div v-cloak>
            <div v-show="newArea">
                <div><span>您当前查看的的是-{{showName}}-</span>{{time}}<span>月的绩效分</span></div>
                <br>
                <div class="content_main">
                    <div v-for="(data,index) in list">
                        
                            <span>{{data.code}}-</span><span>{{data.detail}}</span>
                            <span>--(</span><span>{{data.originalScore}}</span><span>分)</span>
                            <div class="input_area">
                                <group>
                                    <cell title="自 评 分 ：" :value="data.selfScore" value-align="left"></cell>
                                    <cell title="详情描述：" :value="data.description" value-align="left"></cell>
                                    <cell title="组长评分：" :value="data.tlScore" value-align="left"></cell>
                                </group>
                            </div>
                        
                    </div>
                </div>
                <div style="padding:15px;">
                    <flexbox>
                        <flexbox-item>
                            <x-button link="/work" type="primary">返 回</x-button>
                        </flexbox-item>
                    </flexbox>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import { CellBox, Cell, Group, Step, StepItem, XHr, XInput, PopupPicker, Datetime, XTextarea, XSwitch, XButton, Toast, Grid, GridItem, FlexboxItem, Flexbox, Msg, Loading } from 'vux'

export default {
    components: {
        CellBox,
        Cell,
        Group,
        Step,
        StepItem,
        XButton,
        XHr,
        XInput,
        PopupPicker,
        Datetime,
        XTextarea,
        XSwitch,
        Toast,
        Grid,
        GridItem,
        FlexboxItem,
        Flexbox,
        Msg,
        Loading
    },
    data() {
        
        var routerParams = this.$route.query.staffId
        var pmonth = this.$route.query.month
        var pyear = this.$route.query.year
        var currentTimeStr = pyear + '-' + pmonth
        return {
            staffId: routerParams,
            showName: '',
            list: [],
            inputData: [],
            dateList: [],
            time: currentTimeStr,
            newArea: true,
            finishArea: false,
            loading: false,
            month: pmonth,
            year: pyear
        }
    },
    mounted: function() {
        this.getData()
    },
    methods: {
        getData: function(value) {
            var self = this
            self.dateList = self.time.split('-')
            self.$ajax({
                    method: 'get',
                    url: '../wx/performance/detail',
                    params: {
                        staffId: self.staffId,
                        year: self.year,
                        month: self.month,
                    }
                })
                .then(function(res) {
                    self.list = res.data
                    var ls = self.list
                    self.showName = ls[0].name
                    self.inputData = new Array()
                    for (var i = 0; i < self.list.length; i++) {
                        self.inputData[i] = {id: ls[i].scoreId}
                        self.inputData[i].tLScore = ls[i].selfScore
                    }
                })
                .catch(function(err) {
                    console.log(err)
                })
        }
    }
}

</script>
<style lang="less">
.t2 {
    padding: 4px 4px 4px 20px;
}

.input_area {
    padding: 4px 15px 4px 10px;
    font-size: 12px;
}
[v-cloak] {
  display: none;
}
</style>
